# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Tim S. <stahta01@gmail.com>

_realname=kicad-doc
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-ca"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-de"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-en"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-es"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-fr"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-id"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-it"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ja"
         # "${MINGW_PACKAGE_PREFIX}-${_realname}-nl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-pl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ru"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-zh")
pkgver=7.0.2
pkgrel=1
pkgdesc="Documentation for KiCad (mingw-w64)"
arch=(any)
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://www.kicad.org/"
license=("spdx:GPL-3.0-or-later OR CC-BY-3.0")
makedepends=()
optdepends=("${MINGW_PACKAGE_PREFIX}-kicad-meta"
            "${MINGW_PACKAGE_PREFIX}-kicad")

source=("https://kicad-downloads.s3.cern.ch/docs/kicad-doc-${pkgver}.tar.gz")
sha256sums=('e97f0848226101591973c2447377585d0a578acccd605e4d8f9b37a24c1b19bc')

build_lang() {
  cd "${srcdir}/kicad-doc-${pkgver}/share/doc/kicad/help"
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
  cp -R ${langid} "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
}

for _n in ${pkgname[@]}; do
  eval "package_${_n}() {
    langid="${_n#${MINGW_PACKAGE_PREFIX}-${_realname}-}" build_lang
  }"
done
